package scala.test_class.test_simple

/**
 * @author 黄海峰 2021/4/15 17:29
 * */
class Point(var x: Int = 0, var y: Int = 0) {
  /**
   * 移动point
   * @param dx x 偏移量
   * @param dy y 偏移量
   */
  def move(dx: Int, dy: Int): Unit = {
    x = x + dx
    y = y + dy
  }

  override def toString: String = s"($x,$y)"
}

/**
 * (var x: Int, var y: Int) is primary constructor
 * (var x: Int = 0, var y: Int = 0) set default value
 *
 *  Since toString overrides toString from AnyRef, it is tagged with the override keyword.
 */
